Make: fix dependency files generation
authorJuan Castillo <[email protected]>
Thu, 22 Oct 2015 10:34:44 +0000 (11:34 +0100)
committerJuan Castillo <[email protected]>
Tue, 27 Oct 2015 15:25:00 +0000 (15:25 +0000)
Currently, if no make goal is specified in the command line, 'all'
is assumed by default, but the dependency files are not generated.
This might lead to a successful but inconsistent build. This patch
provides a fix to the problem.

Change-Id: I0148719e114dbdbe46f8a57c7d05da7cbc212c92

Makefile
make_helpers/build_macros.mk

index 31ac5d6f00bdcbdaa6f257dcbc00bf3f359e9878..ac059e825151e91cb717377578600e6bc79e82fb 100644 (file)
--- a/Makefile
+++ b/Makefile
@@ -34,6 +34,9 @@
 VERSION_MAJOR                  := 1
 VERSION_MINOR                  := 1
 
+# Default goal is build all images
+.DEFAULT_GOAL                  := all
+
 include make_helpers/build_macros.mk
 
 ################################################################################
@@ -375,9 +378,6 @@ endif
 # Build targets
 ################################################################################
 
-# Default target
-.DEFAULT_GOAL := all
-
 .PHONY:        all msg_start clean realclean distclean cscope locate-checkpatch checkcodebase checkpatch fiptool fip certtool
 .SUFFIXES:
 
index 0e2e2ac9fa2ae8bc6aee4c7855910b0302b6daf0..9ab6e648865345cfa41248a501b42caab1ef0bf5 100644 (file)
@@ -112,6 +112,12 @@ endef
 # Auxiliary macros to build TF images from sources
 ################################################################################
 
+# If no goal is specified in the command line, .DEFAULT_GOAL is used.
+# .DEFAULT_GOAL is defined in the main Makefile before including this file.
+ifeq ($(MAKECMDGOALS),)
+MAKECMDGOALS := $(.DEFAULT_GOAL)
+endif
+
 define match_goals
 $(strip $(foreach goal,$(1),$(filter $(goal),$(MAKECMDGOALS))))
 endef